<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName()
            + path + "/com";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>CST</title>
    <script src="../resource/mp/jquery.mobile/js/jquery-2.0.2.min.js"></script>
    <script type="text/javascript">
        alert("1111");
        $(function(){
            alert("init()");
            var urlData = document.getElementById("urlData").value;
            if(urlData == "fail"){
                alert('没有文件');
                return;
            }else if(urlData == "error"){
                alert('此文件格式不支持预览');
                return;
            }
            var prefix = document.getElementById("prefix").value;
            var url = document.getElementById("fileUrl").value;
            if(prefix != "pdf"){
                $("#file-content").append("<div style='width:1024px;overflow-x: scroll;'><embed  width='100%' height='800'  src='"+url+"'></div>");
                return;
            }
            alert("prefix:"+prefix);
            $("#file-content").append(urlData);
        });

    </script>
</head>

<body>
    <input type="text" id="fileUrl" value="<s:property value="fileUrl" />">
    <input type="text" id="urlData" value="<s:property value="urlData" />">
    <input type="text" id="prefix" value="<s:property value="prefix" />">

    <div id="file-content">

    </div>

</body>
</html>

